package com.mlan.userap.model;

import java.io.Serializable;
import java.util.List;

public class ChatGroupInfo implements Comparable<ChatGroupInfo> {
    private String groupId;
    private int groupType;
    private String groupName;
    private String groupAvatar;
    private long msgTicks;
    private MsgResp lastMsg;
    private List<ChatUser> userList;
    private long topSequ;
    private int unread;

    private int dnd;

    // Getters and setters
    public String getGroupId() {
        return groupId;
    }

    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    public int getGroupType() {
        return groupType;
    }

    public void setGroupType(int groupType) {
        this.groupType = groupType;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public String getGroupAvatar() {
        return groupAvatar;
    }

    public void setGroupAvatar(String groupAvatar) {
        this.groupAvatar = groupAvatar;
    }

    public long getMsgTicks() {
        return msgTicks;
    }

    public void setMsgTicks(long msgTicks) {
        this.msgTicks = msgTicks;
    }

    public MsgResp getLastMsg() {
        return lastMsg;
    }

    public void setLastMsg(MsgResp lastMsg) {
        this.lastMsg = lastMsg;
    }

    public List<ChatUser> getUserList() {
        return userList;
    }

    public void setUserList(List<ChatUser> userList) {
        this.userList = userList;
    }

    public long getTopSequ() {
        return topSequ;
    }

    public void setTopSequ(long topSequ) {
        this.topSequ = topSequ;
    }

    public int getUnread() {
        return unread;
    }

    public void setUnread(int unread) {
        this.unread = unread;
    }

    public int getDnd() {
        return dnd;
    }

    public void setDnd(int dnd) {
        this.dnd = dnd;
    }

    @Override
    public int compareTo(ChatGroupInfo other) {
        // 首先比较 topSequ（置顶优先级），降序
        int topCompare = Long.compare(other.topSequ, this.topSequ);
        if (topCompare != 0) {
            return topCompare;
        }
        // 如果 topSequ 相等，比较 msgTicks，降序（新消息在上）
        return Long.compare(other.msgTicks, this.msgTicks);
    }

}